﻿using System;
using System.Linq;
using Thuoc24h.Common;

namespace Thuoc24h.AdminCP.Pages
{
    public partial class ViewContact : BasePage.BasePages
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["ID"].ToInt32Return0();
            var contact = context.Contacts.SingleOrDefault(item => item.Id == id);

            if (contact != null)
            {
                ltrName.Text = contact.Name;
                ltrPhone.Text = contact.PhoneNumber;
                ltrEmail.Text = contact.Email;
                ltrDetail.Text = contact.Detail;
                ltrCreatedDate.Text = contact.CreatedDate.ToString();
                ltrAddress.Text = contact.Address;
                if (!(bool) contact.IsRead)
                {
                    contact.IsRead = true;
                    context.SaveChanges();
                }
               
            }
        }
    }
}